﻿using Compass.Wasm.Shared.Purchases;
using Zack.DomainCommons.Models;

namespace Compass.PurchaseService.Domain.Entities;

public record NavInvReportClass : AggregateRootEntity
{
    public DateTime YearMonth { get; private set; }
    public double RawMtlValue{ get; private set; }
    public double SemiProdValue { get; private set; }
    public double FgTradeValue { get; private set; }
    public double FsSubtotal { get; private set; }
    public int MTPT { get; private set; }
    public double RecvValue { get; private set; }
    public double ConsValue { get; private set; }
    public double Gap { get; private set; }

    private NavInvReportClass() { }
    public NavInvReportClass(Guid id,DateTime yearMonth,double rawMtlValue,double semiProdValue,double fgTradeValue,double fsSubtotal,int mtpt,double recvValue,double consValue,double gap)
    {
        Id=id;
        YearMonth=yearMonth;
        RawMtlValue=rawMtlValue;
        SemiProdValue=semiProdValue;
        FgTradeValue=fgTradeValue;
        FsSubtotal=fsSubtotal;
        MTPT=mtpt;
        RecvValue=recvValue;
        ConsValue=consValue;
        Gap =gap;
    }

    #region Update
    public void Update(NavInvReportClassDto dto)
    {
        ChangeYearMonth(dto.YearMonth)
            .ChangeRawMtlValue(dto.RawMtlValue)
            .ChangeSemiProdValue(dto.SemiProdValue)
            .ChangeFgTradeValue(dto.FgTradeValue)
            .ChangeFsSubtotal(dto.FsSubtotal)
            .ChangeMTPT(dto.MTPT)
            .ChangeRecvValue(dto.RecvValue)
            .ChangeConsValue(dto.ConsValue)
            .ChangeGap(dto.Gap);

        NotifyModified();
    }

   public NavInvReportClass ChangeYearMonth(DateTime yearMonth)
    {
        YearMonth=yearMonth;
        return this;
    }
    public NavInvReportClass ChangeRawMtlValue(double rawMtlValue)
    {
        RawMtlValue= rawMtlValue;
        return this;
    }
    public NavInvReportClass ChangeSemiProdValue(double semiProdValue)
    {
        SemiProdValue= semiProdValue;
        return this;
    }
    public NavInvReportClass ChangeFgTradeValue(double fgTradeValue)
    {
        FgTradeValue= fgTradeValue;
        return this;
    }
    public NavInvReportClass ChangeFsSubtotal(double fsSubtotal)
    {
        FsSubtotal= fsSubtotal;
        return this;
    }

    public NavInvReportClass ChangeMTPT(int mtpt)
    {
        MTPT= mtpt;
        return this;
    }
    public NavInvReportClass ChangeRecvValue(double recvValue)
    {
        RecvValue= recvValue;
        return this;
    }
    public NavInvReportClass ChangeConsValue(double consValue)
    {
        ConsValue= consValue;
        return this;
    }
    public NavInvReportClass ChangeGap(double gap)
    {
        Gap= gap;
        return this;
    }

    #endregion
}